package GUI;

import java.awt.*;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;


public class PetriNetEditor extends JFrame {

	private static final long serialVersionUID = -5601784005449367542L;
	Container pane = this.getContentPane();
	public static final int FrameWidth = 600, FrameHeight = 800;

	PN_Draw_Panel drawPanel;
	
	public PetriNetEditor() {
		super("Petri Net Editor");
		pane.setLayout(new FlowLayout());
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		
		
		drawPanel = new PN_Draw_Panel(this);
		JScrollPane jsp = new JScrollPane(drawPanel,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
		jsp.setPreferredSize(new Dimension(510,510));
		jsp.setBorder(BorderFactory.createTitledBorder("Draw Area"));
		jsp.setBackground(Color.white);
		PN_Pointer_Panel pointerPanel = new PN_Pointer_Panel(drawPanel);
		PN_Interval_Panel intervalPanel = new PN_Interval_Panel(drawPanel);	
		PN_Control_Panel controlPanel = new PN_Control_Panel(drawPanel);		
		PN_Analysis_Panel analysisPanel = new PN_Analysis_Panel(drawPanel);
		PN_Menu menu = new PN_Menu(this, drawPanel);
		
		this.setJMenuBar(menu);
		pane.add(pointerPanel);
		pane.add(intervalPanel);
		pane.add(controlPanel);
		pane.add(analysisPanel);
		pane.add(jsp);
		
		Dimension SceenSize = Toolkit.getDefaultToolkit().getScreenSize();
		this.setBounds(SceenSize.width/2 - FrameWidth/2, SceenSize.height/2 - FrameHeight/2, FrameWidth, FrameHeight);
		this.setVisible(true);

	}
	
	public void refresh() {
		drawPanel.repaint();
	}

}
